<ui:composition template="/WEB-INF/templates/main-template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<ui:param name="pageName" value="Employee Birth Days" />
	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/templates/public-sidebar.xhtml" />
	</ui:define>
	<ui:define name="content">
		
		<h:form>
		<p:growl id="growl"/>
			<h:panelGrid style="width: 100%;"> 
				<h:outputText value="Birth Day Greetings(Today)" styleClass="outputTextTitle" />		
					
				<p:dataTable tableStyle="width:100%" id="birthDayTable" value="#{birthdayWishesBean.birthDayWishesList}"
					var="row" paginator="true" rows="20">

					<p:column headerText="S.No" >
						<h:outputText value="#{row.sNo}" />
					</p:column>

					<p:column headerText="Date of Birth" >
						<h:outputText value="#{row.employee.dateOfBirth}">
							<f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{birthdayWishesBean.timeZone}"/> 
						</h:outputText>
					</p:column>

					<p:column headerText="Employee Name">
						<h:outputText value="#{row.employee.firstName} #{row.employee.lastName}" />
					</p:column>
					
					<p:column headerText="Employee Code" >
						<h:outputText value="#{row.employee.employeeCode}" />
					</p:column>
					
					<p:column headerText="Email" >
						<h:outputText value="#{row.employee.email}" />
					</p:column>
					
					<p:column headerText="Contact No" >
						<h:outputText value="#{row.employee.telephone}" />
					</p:column>
					
					<p:column headerText="Module Name" >
						<h:outputText value="#{row.employee.moduleName}" />
					</p:column>
					
					
					
					<p:column headerText="Send Greetings" >
						 <p:commandButton value="Send" oncomplete="confirmationDialog.show()" update="@form" process="@this" 
							actionListener="#{birthdayWishesBean.birthdayListener}" >
							 <f:param id="birthDayId" name="birthDayId" value="#{row.birthDayWishesId}" />
						 </p:commandButton>
					</p:column>

					
					
				</p:dataTable>
			</h:panelGrid>
			
			    
     <!-- DIALOG BOX CODE -->
	<p:dialog hideEffect="fade" showEffect="fade"
				header="Send Greetings"
				id="confirmationDialog" widgetVar="confirmationDialog" resizable="false"
				modal="true">
			<p:scrollPanel style="height: 250px; width:600px; padding: 0; margin: 0; " mode="native">  	
			<h:panelGrid id="dialogContent" columns="3" cellspacing="10" >
			   
	         <h:outputLabel value="Employee Name " />
	         <h:outputLabel value=":" />
	         <h:outputLabel value="#{birthdayWishesBean.birthDayWishes.employee.firstName} #{birthdayWishesBean.birthDayWishes.employee.lastName}" />
	         
	         <h:outputLabel value="Module Name " />
	         <h:outputLabel value=":" />
	         <h:outputLabel value="#{birthdayWishesBean.birthDayWishes.employee.moduleName}" />
	         
	         <h:outputLabel value="Sent By " />
	         <h:outputLabel value=":" />
	         <h:outputLabel value="#{birthdayWishesBean.birthDayWishes.modifiedBy}" />
	         				
		    </h:panelGrid>
		    <h:outputLabel value="Enter your greetings :" style="font-weight:bold;"/><br />
		    <p:inputTextarea id="reply" rows="6" style="width:570px;"  value="#{birthdayWishesBean.birthDayWishes.wishMessage}"/>
		
		</p:scrollPanel>  
		<h:panelGroup style="float:right;">
			<p:commandButton id="submitButton" value="Submit" action="#{birthdayWishesBean.saveBirthDayGreetingsAction}"
					 update="growl">
			</p:commandButton>	
			<p:commandButton id="closeButton" process="@this" value="Close" oncomplete="confirmationDialog.hide()" update="@form"/>
			
		</h:panelGroup>
			
	</p:dialog>	

		</h:form>
	</ui:define>
</ui:composition>

